/*     */ package com.umeng.newxp.controller;
/*     */ 
/*     */ import android.content.Context;
/*     */ import android.content.IntentFilter;
/*     */ import android.content.SharedPreferences;
/*     */ import android.content.SharedPreferences.Editor;
/*     */ import android.content.res.Configuration;
/*     */ import android.content.res.Resources;
/*     */ import android.location.Location;
/*     */ import android.os.Build;
/*     */ import android.os.Build.VERSION;
/*     */ import android.os.Handler;
/*     */ import android.os.Message;
/*     */ import android.text.TextUtils;
/*     */ import com.umeng.common.Log;
/*     */ import com.umeng.common.util.h;
/*     */ import com.umeng.newxp.Promoter;
/*     */ import com.umeng.newxp.UBroadcastReceiver;
/*     */ import com.umeng.newxp.a;
/*     */ import com.umeng.newxp.common.ExchangeConstants;
/*     */ import com.umeng.newxp.net.XpReportClient;
/*     */ import com.umeng.newxp.net.e.a;
/*     */ import com.umeng.newxp.net.f;
/*     */ import java.util.ArrayList;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Locale;
/*     */ import java.util.Map;
/*     */ import java.util.Random;
/*     */ import org.json.JSONObject;
/*     */ 
/*     */ public class ExchangeDataService
/*     */ {
/*  84 */   private String a = ExchangeDataService.class.getName();
/*     */   public long oid;
/*  99 */   public long[] timeLine = new long[4];
/*     */ 
/* 122 */   public int autofill = 1;
/*     */ 
/* 124 */   public String sessionId = "";
/*     */ 
/* 129 */   public String landing_image = "";
/*     */ 
/* 131 */   public int layoutType = -1;
/*     */ 
/* 136 */   public int displayStyle = 0;
/*     */ 
/* 141 */   public int require_desc = 1;
/*     */ 
/* 143 */   private String b = "";
/*     */ 
/* 148 */   private boolean c = true;
/*     */ 
/* 150 */   private boolean d = false;
/*     */ 
/* 155 */   private int e = 0;
/*     */ 
/* 157 */   private boolean f = false;
/*     */ 
/* 162 */   public String slot_id = "";
/*     */ 
/* 168 */   public String appkey = "";
/*     */ 
/* 183 */   public boolean pagination = false;
/*     */ 
/* 185 */   public boolean show_progress_wheel = true;
/*     */ 
/* 189 */   public String opensize = "";
/*     */   public Context mContext;
/* 198 */   public int page_index = -1;
/*     */ 
/* 202 */   public XpListenersCenter.ExchangeDataRequestListener mDataReceiverListener = null;
/*     */   private static final int g = 0;
/*     */   private static final int h = 1;
/*     */   private String i;
/* 220 */   private String j = "PROMOTERS_FIRST_PAGE_";
/*     */ 
/* 225 */   private String k = "PROMOTERS_NEXT_PAGE_";
/*     */ 
/* 231 */   private String l = "";
/*     */ 
/* 236 */   private String m = "";
/*     */ 
/* 242 */   private String n = "";
/*     */ 
/* 247 */   private String o = "";
/*     */   public XpListenersCenter.InitializeListener initializeListener;
/*     */   public a preloadData;
/* 286 */   public int newTips = -1;
/*     */ 
/* 288 */   public static int DEBUG_NEW_TIPS = -1;
/*     */   private static final String p = "EXCHANGE_PRELOAD_ADS";
/*     */   private String q;
/* 893 */   public boolean broadcast = false;
/*     */ 
/*     */   public String getTimeConsuming()
/*     */   {
/* 106 */     if ((this.timeLine != null) && (this.timeLine.length == 4) && (this.timeLine[0] > 0L)) {
/* 107 */       long l1 = this.timeLine[0];
/* 108 */       long l2 = this.timeLine[1];
/* 109 */       long l3 = this.timeLine[2];
/* 110 */       long l4 = this.timeLine[3];
/*     */ 
/* 112 */       long l5 = l2 - l1;
/* 113 */       long l6 = l4 - l3;
/* 114 */       if ((l5 > 0L) && (l6 > 0L)) return l5 + "_" + l6;
/*     */     }
/* 116 */     return null;
/*     */   }
/*     */ 
/*     */   public ExchangeDataService(String paramString)
/*     */   {
/* 171 */     this.slot_id = paramString;
/* 172 */     this.oid = System.currentTimeMillis();
/*     */   }
/*     */ 
/*     */   public ExchangeDataService() {
/* 176 */     this("");
/* 177 */     this.oid = System.currentTimeMillis();
/*     */   }
/*     */ 
/*     */   public void preloadData(Context paramContext, XpListenersCenter.NTipsChangedListener paramNTipsChangedListener, int paramInt)
/*     */   {
/* 261 */     preloadData(paramContext, null, paramNTipsChangedListener, paramInt);
/*     */   }
/*     */ 
/*     */   public void preloadData(Context paramContext, List<Promoter> paramList, XpListenersCenter.NTipsChangedListener paramNTipsChangedListener, int paramInt) {
/* 265 */     if ((this.layoutType > -1) && (this.layoutType != paramInt)) {
/* 266 */       Log.e(this.a, "sorry  type is no match ");
/* 267 */       return;
/*     */     }
/* 269 */     this.layoutType = paramInt;
/*     */ 
/* 272 */     if (this.preloadData == null)
/* 273 */       this.preloadData = new a(paramContext, this, paramNTipsChangedListener);
/*     */     else {
/* 275 */       this.preloadData.a(paramNTipsChangedListener);
/*     */     }
/* 277 */     if ((paramList != null) && (paramList.size() > 0))
/* 278 */       this.preloadData.a(paramList);
/*     */     else
/* 280 */       this.preloadData.a();
/*     */   }
/*     */ 
/*     */   private int a(List<Promoter> paramList)
/*     */   {
/* 317 */     if (paramList == null) return 0;
/*     */ 
/* 319 */     int i1 = 0;
/* 320 */     ArrayList localArrayList = new ArrayList();
/* 321 */     for (int i2 = paramList.size() - 1; i2 >= 0; i2--) {
/* 322 */       if (com.umeng.common.b.a(((Promoter)paramList.get(i2)).app_package_name, this.mContext)) {
/* 323 */         Log.a(ExchangeConstants.LOG_TAG, "Installed: " + ((Promoter)paramList.get(i2)).title + 
/* 324 */           ". Remove from the list.");
/* 325 */         Promoter localPromoter = (Promoter)paramList.remove(i2);
/* 326 */         localArrayList.add(localPromoter);
/* 327 */         if (localPromoter.new_tip == 1) {
/* 328 */           i1++;
/*     */         }
/*     */       }
/*     */     }
/* 332 */     if (localArrayList.size() > 0) {
/* 333 */       com.umeng.newxp.net.e locale = new e.a(this.mContext)
/* 334 */         .a(-1).b(-1).d(-1)
/* 335 */         .c(this.layoutType).a((Promoter[])localArrayList.toArray(new Promoter[0]))
/* 336 */         .d(getTimeConsuming()).c(this.sessionId).b(com.umeng.newxp.common.g.a(this.mContext, this)).a(this.slot_id)
/* 337 */         .a();
/* 338 */       new XpReportClient(this.mContext).sendAsync(locale, null);
/*     */     }
/*     */ 
/* 341 */     return i1;
/*     */   }
/*     */ 
/*     */   private Map<String, Object> a()
/*     */   {
/* 350 */     HashMap localHashMap = new HashMap();
/*     */     try
/*     */     {
/* 358 */       localHashMap.put("sdk_version", ExchangeConstants.sdk_version);
/* 359 */       localHashMap.put("protocol_version", 
/* 360 */         ExchangeConstants.protocol_version);
/*     */ 
/* 363 */       if (!h.d(this.slot_id)) {
/* 364 */         localHashMap.put("slot_id", this.slot_id);
/*     */       } else {
/* 366 */         str1 = com.umeng.newxp.common.g.a(this.mContext, this);
/*     */ 
/* 368 */         if (!h.d(str1)) {
/* 369 */           localHashMap.put("app_key", str1);
/*     */         } else {
/* 371 */           Log.b(ExchangeConstants.LOG_TAG, 
/* 372 */             "Both UMENG_APPKEY and UMENG_SLOTID are empty, please specify either one. Request aborted.");
/* 373 */           return null;
/*     */         }
/*     */       }
/*     */ 
/* 377 */       String str1 = com.umeng.common.b.g(this.mContext);
/* 378 */       localHashMap.put("device_id", str1);
/* 379 */       localHashMap.put("idmd5", h.a(str1));
/* 380 */       localHashMap.put("device_model", Build.MODEL);
/* 381 */       localHashMap.put("os", "android");
/*     */ 
/* 383 */       String str2 = com.umeng.common.b.r(this.mContext);
/* 384 */       if (!TextUtils.isEmpty(str2)) {
/* 385 */         localHashMap.put("mc", str2);
/*     */       }
/* 387 */       String str3 = com.umeng.newxp.common.g.y(this.mContext);
/* 388 */       if (!TextUtils.isEmpty(str3)) localHashMap.put("channel", 
/* 389 */           com.umeng.newxp.common.g.y(this.mContext));
/*     */ 
/* 391 */       localHashMap.put("layout_type", Integer.valueOf(this.layoutType));
/*     */ 
/* 393 */       localHashMap.put("os_version", Build.VERSION.RELEASE);
/* 394 */       localHashMap.put("channel", com.umeng.newxp.common.g.y(this.mContext));
/*     */ 
/* 396 */       Configuration localConfiguration = this.mContext.getResources().getConfiguration();
/* 397 */       if ((localConfiguration != null) && (localConfiguration.locale != null)) {
/* 398 */         localHashMap.put("locale", localConfiguration.locale.getDisplayName());
/* 399 */         localHashMap.put("language", localConfiguration.locale.toString());
/*     */       } else {
/* 401 */         localHashMap.put("locale", "null");
/* 402 */         localHashMap.put("language", "null");
/*     */       }
/*     */ 
/* 405 */       localHashMap.put("timezone", Integer.valueOf(com.umeng.common.b.o(this.mContext)));
/*     */ 
/* 407 */       localHashMap.put("resolution", 
/* 408 */         com.umeng.common.b.j(this.mContext));
/*     */       try
/*     */       {
/* 411 */         String[] arrayOfString = com.umeng.common.b.k(this.mContext);
/* 412 */         localHashMap.put("access", arrayOfString[0]);
/*     */ 
/* 415 */         if ("2G/3G".equals(arrayOfString[0]))
/* 416 */           localHashMap.put("access_subtype", arrayOfString[1]);
/*     */       }
/*     */       catch (Exception localException2) {
/* 419 */         localHashMap.put("access", "Unknown");
/*     */       }
/*     */ 
/* 423 */       localHashMap.put("carrier", 
/* 424 */         com.umeng.common.b.i(this.mContext));
/*     */ 
/* 427 */       Location localLocation = com.umeng.common.b.m(this.mContext);
/* 428 */       if (localLocation != null) {
/* 429 */         localHashMap.put("lat", 
/* 430 */           String.valueOf(localLocation.getLatitude()));
/* 431 */         localHashMap.put("lng", 
/* 432 */           String.valueOf(localLocation.getLongitude()));
/* 433 */         long l1 = localLocation.getTime();
/* 434 */         localHashMap.put("gpst", 
/* 435 */           String.valueOf(l1));
/*     */       }
/*     */ 
/* 438 */       String str4 = com.umeng.common.b.a();
/* 439 */       localHashMap.put("cpu", str4);
/*     */ 
/* 441 */       String str5 = h.a();
/* 442 */       String str6 = str5.split(" ")[0];
/* 443 */       String str7 = str5.split(" ")[1];
/*     */ 
/* 445 */       localHashMap.put("date", str6);
/* 446 */       localHashMap.put("time", str7);
/*     */ 
/* 449 */       localHashMap.put("timezone", Integer.valueOf(com.umeng.common.b.o(this.mContext)));
/*     */ 
/* 451 */       String str8 = com.umeng.common.b.v(this.mContext);
/* 452 */       if (!TextUtils.isEmpty(str8)) {
/* 453 */         localHashMap.put("apnm", str8);
/*     */       }
/*     */ 
/* 456 */       String str9 = com.umeng.common.b.e(this.mContext);
/* 457 */       if (!TextUtils.isEmpty(str9)) {
/* 458 */         localHashMap.put("apvn", str9);
/*     */       }
/*     */ 
/* 461 */       String str10 = com.umeng.common.b.d(this.mContext);
/* 462 */       if (!TextUtils.isEmpty(str10)) {
/* 463 */         localHashMap.put("apvc", str10);
/*     */       }
/*     */ 
/* 466 */       String str11 = com.umeng.common.b.f(this.mContext);
/* 467 */       if (!TextUtils.isEmpty(str10)) {
/* 468 */         localHashMap.put("adnm", str11);
/*     */       }
/*     */ 
/* 471 */       if ((this.b != null) && (!"".equals(this.b))) localHashMap.put(
/* 472 */           "keywords", this.b);
/*     */ 
/* 478 */       if (this.autofill != 1) localHashMap.put("autofill", Integer.valueOf(this.autofill));
/*     */ 
/* 480 */       if (this.require_desc != 1) localHashMap.put("require_desc", Integer.valueOf(this.require_desc));
/*     */ 
/* 484 */       if ((!h.d(this.sessionId)) && (this.page_index > -1)) {
/* 485 */         localHashMap.put("sid", this.sessionId);
/* 486 */         Log.c(ExchangeConstants.LOG_TAG, "sid = " + this.sessionId + "\tpage_index = " + 
/* 487 */           this.page_index);
/*     */       }
/*     */ 
/* 490 */       if (this.pagination)
/* 491 */         localHashMap.put("more", Integer.valueOf(1));
/*     */     }
/*     */     catch (Exception localException1)
/*     */     {
/* 495 */       localException1.printStackTrace();
/* 496 */       Log.e(ExchangeConstants.LOG_TAG, "ERROR GET INPUT.");
/*     */     }
/*     */ 
/* 499 */     return localHashMap;
/*     */   }
/*     */ 
/*     */   public void requestDataAsyn(Context paramContext, XpListenersCenter.ExchangeDataRequestListener paramExchangeDataRequestListener, boolean paramBoolean) {
/* 503 */     if (paramBoolean) {
/* 504 */       this.sessionId = "";
/* 505 */       this.page_index = -1;
/* 506 */     } else if (!TextUtils.isEmpty(this.sessionId)) {
/* 507 */       this.page_index += 1;
/*     */     }
/*     */ 
/* 510 */     requestDataAsyn(paramContext, paramExchangeDataRequestListener);
/*     */   }
/*     */ 
/*     */   public void requestDataAsyn(Context paramContext, XpListenersCenter.ExchangeDataRequestListener paramExchangeDataRequestListener)
/*     */   {
/* 521 */     this.i = 
/* 522 */       ("EXCHANGE_PRELOAD_ADS_" + this.b + "_" + 
/* 522 */       this.autofill);
/* 523 */     this.mContext = paramContext;
/*     */     Object localObject;
/* 526 */     if ((TextUtils.isEmpty(this.o)) || (TextUtils.isEmpty(this.l)) || 
/* 527 */       (TextUtils.isEmpty(this.n)) || (TextUtils.isEmpty(this.m))) {
/* 528 */       if (TextUtils.isEmpty(this.slot_id)) {
/* 529 */         localObject = com.umeng.newxp.common.g.a(this.mContext, this);
/* 530 */         if (TextUtils.isEmpty((CharSequence)localObject)) { Log.b(this.a, "No found Slot_id or Appkey!!!!!");
/*     */         } else {
/* 532 */           this.o = ("PRELOAD_KEY_" + (String)localObject);
/* 533 */           this.l = (this.j + (String)localObject);
/* 534 */           this.n = (this.k + (String)localObject);
/* 535 */           this.m = ("PRELOAD_UPDATE_DATE_" + (String)localObject);
/*     */         }
/*     */       } else {
/* 538 */         this.o = ("PRELOAD_KEY_" + this.slot_id);
/* 539 */         this.l = (this.j + this.slot_id);
/* 540 */         this.n = (this.k + this.slot_id);
/* 541 */         this.m = ("PRELOAD_UPDATE_DATE_" + this.slot_id);
/*     */       }
/*     */     }
/*     */ 
/* 545 */     if ((ExchangeConstants.ONLY_CHINESE) && (!com.umeng.common.b.a(this.mContext))) {
/* 546 */       Log.b(ExchangeConstants.LOG_TAG, "English os can not show ads");
/* 547 */       paramExchangeDataRequestListener.dataReceived(0, null);
/* 548 */       if (this.mDataReceiverListener != null)
/* 549 */         this.mDataReceiverListener.dataReceived(0, null);
/*     */     }
/*     */     else
/*     */     {
/* 553 */       localObject = this.mContext.getSharedPreferences(this.i, 
/* 554 */         0);
/* 555 */       int i1 = ((SharedPreferences)localObject).getInt(this.o, 0);
/*     */ 
/* 558 */       a(paramExchangeDataRequestListener, i1);
/*     */     }
/*     */   }
/*     */ 
/*     */   private void a(XpListenersCenter.ExchangeDataRequestListener paramExchangeDataRequestListener, int paramInt) {
/* 563 */     if (paramInt == 1)
/* 564 */       b(paramExchangeDataRequestListener, paramInt);
/*     */     else
/* 566 */       new a(paramExchangeDataRequestListener, 0, null).start();
/*     */   }
/*     */ 
/*     */   private void b(XpListenersCenter.ExchangeDataRequestListener paramExchangeDataRequestListener, int paramInt)
/*     */   {
/* 579 */     boolean bool = TextUtils.isEmpty(this.sessionId);
/* 580 */     c localc = new c(this, paramExchangeDataRequestListener, bool);
/*     */ 
/* 636 */     new a(localc, 1, null).start();
/*     */   }
/*     */ 
/*     */   public void setKeywords(String paramString) {
/* 640 */     this.b = paramString;
/*     */   }
/*     */ 
/*     */   public boolean isFilterInstalledApp()
/*     */   {
/* 870 */     return this.c;
/*     */   }
/*     */ 
/*     */   public void setFilterInstalledApp(boolean paramBoolean) {
/* 874 */     this.d = true;
/* 875 */     this.c = paramBoolean;
/*     */   }
/*     */ 
/*     */   public void setTemplate(int paramInt) {
/* 879 */     if (paramInt > -1) {
/* 880 */       this.e = (paramInt > 1 ? 1 : paramInt);
/* 881 */       this.f = true;
/*     */     }
/*     */   }
/*     */ 
/*     */   public int getTemplate() {
/* 886 */     return this.e;
/*     */   }
/*     */ 
/*     */   public String getBroadCastAction(Context paramContext)
/*     */   {
/* 900 */     if (TextUtils.isEmpty(this.q)) {
/* 901 */       String str1 = com.umeng.newxp.common.g.a(this.mContext, this);
/* 902 */       String str2 = h.a(TextUtils.isEmpty(this.slot_id) ? str1 : this.slot_id);
/* 903 */       this.q = (com.umeng.common.b.v(paramContext) + "." + str2);
/*     */     }
/* 905 */     Log.c(this.a, "Get BroadcastAction " + this.q);
/* 906 */     return this.q;
/*     */   }
/*     */ 
/*     */   public void registerBroadcast(Context paramContext, UBroadcastReceiver paramUBroadcastReceiver)
/*     */   {
/* 915 */     this.broadcast = true;
/* 916 */     IntentFilter localIntentFilter = new IntentFilter(getBroadCastAction(paramContext));
/* 917 */     localIntentFilter.setPriority(1000);
/* 918 */     paramContext.registerReceiver(paramUBroadcastReceiver, localIntentFilter);
/*     */   }
/*     */ 
/*     */   public void unregisterBroadcast(Context paramContext, UBroadcastReceiver paramUBroadcastReceiver)
/*     */   {
/* 927 */     paramContext.unregisterReceiver(paramUBroadcastReceiver);
/*     */   }
/*     */ 
/*     */   public void reportImpression(Promoter[] paramArrayOfPromoter)
/*     */   {
/* 935 */     if ((paramArrayOfPromoter == null) || (paramArrayOfPromoter.length == 0)) {
/* 936 */       Log.e(this.a, "unable send impression report.[promoters=" + (paramArrayOfPromoter == null ? 0 : paramArrayOfPromoter.length) + "]");
/* 937 */       return;
/*     */     }
/* 939 */     com.umeng.newxp.net.e locale = new e.a(this.mContext)
/* 940 */       .a(0).b(0)
/* 941 */       .d(3).c(this.layoutType).a(paramArrayOfPromoter)
/* 942 */       .b(com.umeng.newxp.common.g.a(this.mContext, this)).a(this.slot_id).d(getTimeConsuming())
/* 943 */       .c(this.sessionId).a();
/*     */ 
/* 945 */     new XpReportClient(this.mContext).sendAsync(locale, null);
/*     */   }
/*     */ 
/*     */   public void clickOnPromoter(Promoter paramPromoter)
/*     */   {
/* 953 */     b.a(paramPromoter, this.mContext, this, this.layoutType, false);
/*     */   }
/*     */ 
/*     */   class a extends Thread
/*     */   {
/*     */     private XpListenersCenter.ExchangeDataRequestListener b;
/*     */     private int c;
/*     */     private Map<String, Object> d;
/* 648 */     private Handler e = new e(this);
/*     */ 
/*     */     public a(int paramMap, Map<String, Object> arg3)
/*     */     {
/* 688 */       this.b = paramMap;
/*     */       int i;
/* 689 */       this.c = i;
/*     */       Object localObject;
/* 690 */       this.d = localObject;
/*     */     }
/*     */ 
/*     */     private List<Promoter> a() {
/* 694 */       int i = new Random().nextInt(1000);
/*     */       Map localMap;
/* 696 */       if (this.d != null)
/* 697 */         localMap = this.d;
/*     */       else {
/* 699 */         localMap = ExchangeDataService.b(ExchangeDataService.this);
/*     */       }
/* 701 */       if (localMap == null) return null;
/*     */ 
/* 703 */       int j = 1;
/* 704 */       if (localMap.containsKey("sid")) {
/* 705 */         j = TextUtils.isEmpty((String)localMap.get("sid")) ? 1 : 
/* 706 */           0;
/*     */       }
/*     */ 
/* 709 */       com.umeng.newxp.net.g localg = new com.umeng.newxp.net.b().a(new f(localMap));
/*     */ 
/* 711 */       if ((localg == null) || (localg.m == null)) return null;
/*     */ 
/* 713 */       Log.c(ExchangeConstants.LOG_TAG, 
/* 714 */         "\trequestLive get resStr:\t" + localg.m.toString());
/*     */       try
/*     */       {
/* 717 */         List localList = a(localg);
/*     */ 
/* 719 */         if ((localList == null) || (localList.size() <= 0)) {
/* 720 */           return null;
/*     */         }
/*     */ 
/* 728 */         if (this.b == null) {
/* 729 */           SharedPreferences localSharedPreferences = ExchangeDataService.this.mContext.getSharedPreferences(
/* 730 */             ExchangeDataService.c(ExchangeDataService.this), 0);
/* 731 */           synchronized (localSharedPreferences) {
/* 732 */             SharedPreferences.Editor localEditor = localSharedPreferences.edit();
/*     */ 
/* 734 */             localEditor.putLong(ExchangeDataService.d(ExchangeDataService.this), System.currentTimeMillis());
/* 735 */             if (j != 0) {
/* 736 */               localEditor.putString(ExchangeDataService.e(ExchangeDataService.this), localg.m.toString());
/* 737 */               localEditor.commit();
/*     */             } else {
/* 739 */               localEditor.putString(ExchangeDataService.f(ExchangeDataService.this), localg.m.toString());
/* 740 */               localEditor.commit();
/*     */             }
/*     */           }
/*     */         }
/*     */ 
/* 745 */         return localList;
/*     */       }
/*     */       catch (Exception localException) {
/* 748 */         Log.b(ExchangeDataService.g(ExchangeDataService.this), i + "  request from network error:", localException);
/* 749 */       }return null;
/*     */     }
/*     */ 
/*     */     private List<Promoter> a(com.umeng.newxp.net.g paramg)
/*     */     {
/* 760 */       if (!ExchangeDataService.h(ExchangeDataService.this))
/* 761 */         ExchangeDataService.a(ExchangeDataService.this, paramg.c == 1);
/* 762 */       ExchangeConstants.show_size = paramg.b == 1;
/* 763 */       ExchangeDataService.this.opensize = (TextUtils.isEmpty(paramg.i) ? "" : paramg.i);
/* 764 */       if (!ExchangeDataService.i(ExchangeDataService.this)) {
/* 765 */         ExchangeDataService.a(ExchangeDataService.this, paramg.k);
/*     */       }
/* 767 */       if ((ExchangeConstants.DEBUG_MODE) && (ExchangeDataService.DEBUG_NEW_TIPS > -1))
/* 768 */         ExchangeDataService.this.newTips = ExchangeDataService.DEBUG_NEW_TIPS;
/*     */       else {
/* 770 */         ExchangeDataService.this.newTips = paramg.j;
/*     */       }
/* 772 */       if (!h.d(paramg.d)) ExchangeDataService.this.sessionId = paramg.d;
/*     */ 
/* 774 */       if ((paramg.e > 3) && (!ExchangeConstants.IGNORE_SERVER_INTERVAL)) ExchangeConstants.REFRESH_INTERVAL = paramg.e * 1000;
/*     */ 
/* 778 */       SharedPreferences localSharedPreferences = ExchangeDataService.this.mContext.getSharedPreferences(ExchangeDataService.c(ExchangeDataService.this), 
/* 779 */         0);
/* 780 */       if (localSharedPreferences.getInt(ExchangeDataService.j(ExchangeDataService.this), 0) != paramg.g) {
/* 781 */         SharedPreferences.Editor localEditor = localSharedPreferences.edit();
/* 782 */         localEditor.putInt(ExchangeDataService.j(ExchangeDataService.this), paramg.g);
/* 783 */         localEditor.commit();
/* 784 */         Log.c(ExchangeDataService.g(ExchangeDataService.this), "Change the " + ExchangeDataService.j(ExchangeDataService.this) + "   " + paramg.g);
/*     */       }
/*     */ 
/* 787 */       if (!h.d(paramg.h)) ExchangeDataService.this.landing_image = paramg.h;
/*     */ 
/* 789 */       return paramg.l;
/*     */     }
/*     */ 
/*     */     private List<Promoter> b() {
/*     */       try {
/* 794 */         SharedPreferences localSharedPreferences = ExchangeDataService.this.mContext.getSharedPreferences(
/* 795 */           ExchangeDataService.c(ExchangeDataService.this), 0);
/*     */ 
/* 797 */         int i = TextUtils.isEmpty(ExchangeDataService.this.sessionId) ? 1 : 0;
/*     */         String str2;
/* 800 */         if (i != 0) {
/* 801 */           Log.c(ExchangeDataService.g(ExchangeDataService.this), "Request data from first-cache..");
/*     */ 
/* 803 */           Long localLong = Long.valueOf(localSharedPreferences.getLong(ExchangeDataService.d(ExchangeDataService.this), 0L));
/*     */ 
/* 805 */           int j = (System.currentTimeMillis() - localLong.longValue()) / 1000L > 169200L ? 1 : 
/* 806 */             0;
/* 807 */           if (j != 0)
/*     */           {
/* 809 */             synchronized (localSharedPreferences) {
/* 810 */               SharedPreferences.Editor localEditor = localSharedPreferences.edit();
/* 811 */               localEditor.remove(ExchangeDataService.e(ExchangeDataService.this));
/* 812 */               localEditor.remove(ExchangeDataService.f(ExchangeDataService.this));
/* 813 */               localEditor.remove(ExchangeDataService.d(ExchangeDataService.this));
/* 814 */               localEditor.commit();
/*     */             }
/* 816 */             Log.e(ExchangeDataService.g(ExchangeDataService.this), "Cache data is inactivation...");
/* 817 */             return null;
/*     */           }
/* 819 */           str2 = ExchangeDataService.e(ExchangeDataService.this);
/*     */         } else {
/* 821 */           Log.c(ExchangeDataService.g(ExchangeDataService.this), "Request data from second-cache..");
/* 822 */           str2 = ExchangeDataService.f(ExchangeDataService.this);
/*     */         }
/* 824 */         String str1 = localSharedPreferences.getString(str2, null);
/*     */ 
/* 826 */         if (str1 == null) return null;
/*     */ 
/* 828 */         synchronized (localSharedPreferences) {
/* 829 */           localObject1 = localSharedPreferences.edit();
/* 830 */           ((SharedPreferences.Editor)localObject1).remove(str2);
/* 831 */           ((SharedPreferences.Editor)localObject1).commit();
/*     */         }
/*     */ 
/* 834 */         ??? = new JSONObject(str1);
/*     */ 
/* 837 */         Object localObject1 = a(new com.umeng.newxp.net.g((JSONObject)???));
/* 838 */         if ((localObject1 == null) || (((List)localObject1).size() <= 0)) {
/* 839 */           return null;
/*     */         }
/* 841 */         return localObject1;
/*     */       } catch (Exception localException) {
/* 843 */         localException.printStackTrace();
/* 844 */       }return null;
/*     */     }
/*     */ 
/*     */     public void run()
/*     */     {
/* 850 */       boolean bool = TextUtils.isEmpty(ExchangeDataService.this.sessionId);
/* 851 */       if (bool)
/* 852 */         ExchangeDataService.this.timeLine[0] = System.currentTimeMillis();
/*     */       List localList;
/* 854 */       if (this.c == 1)
/* 855 */         localList = b();
/*     */       else {
/* 857 */         localList = a();
/*     */       }
/*     */ 
/* 860 */       if (bool) {
/* 861 */         ExchangeDataService.this.timeLine[1] = System.currentTimeMillis();
/*     */       }
/* 863 */       Message localMessage = new Message();
/* 864 */       localMessage.obj = localList;
/* 865 */       this.e.sendMessage(localMessage);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.newxp.controller.ExchangeDataService
 * JD-Core Version:    0.6.2
 */